package com.kjlink.internal.workreport.plan.model;


import cn.xuqiudong.common.base.model.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.kjlink.internal.workreport.base.annotation.NoneColumn;
import com.kjlink.internal.workreport.base.enums.PlanSubmissionStatusEnum;
import com.kjlink.internal.workreport.helper.WeekDateHelper;
import com.kjlink.internal.workreport.plan.lookup.ToAddLookup;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;


/**
 * 周工作计划 实体类
 *
 * @author Vic.xu
 */
public class WorkPlan extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 用户名
     */
    @NoneColumn
    private String userName;

    /**
     * 小组id
     */
    private Integer groupId;

    /**
     * 小组name
     */
    @NoneColumn
    private String groupName;

    /**
     * 周次:2024-01
     */
    private String weekNumber;

    /**
     * 周开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date weekStart;

    /**
     * 周结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date weekEnd;

    /**
     * 实际总工时:人天
     */
    private BigDecimal actualEffort;

    /**
     * 提交状态
     */
    private PlanSubmissionStatusEnum submissionStatus;

    public WorkPlan() {
    }

    public WorkPlan(ToAddLookup lookup) {
        this.weekStart = lookup.getWeekStart();
        this.weekEnd = lookup.getWeekEnd();
        this.userId = lookup.getUserId();
        this.weekNumber = WeekDateHelper.weekNumber(lookup.getWeekStart());
        this.submissionStatus = PlanSubmissionStatusEnum.UN_SUBMITTED;
    }


    /***************** set|get  start **************************************/
    /**
     * set：用户id
     */
    public WorkPlan setUserId(Integer userId) {
        this.userId = userId;
        return this;
    }

    /**
     * get：用户id
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * set：小组id
     */
    public WorkPlan setGroupId(Integer groupId) {
        this.groupId = groupId;
        return this;
    }

    /**
     * get：小组id
     */
    public Integer getGroupId() {
        return groupId;
    }

    /**
     * set：周次:2024-01
     */
    public WorkPlan setWeekNumber(String weekNumber) {
        this.weekNumber = weekNumber;
        return this;
    }

    /**
     * get：周次:2024-01
     */
    public String getWeekNumber() {
        return weekNumber;
    }

    /**
     * set：周开始时间
     */
    public WorkPlan setWeekStart(Date weekStart) {
        this.weekStart = weekStart;
        return this;
    }

    /**
     * get：周开始时间
     */
    public Date getWeekStart() {
        return weekStart;
    }

    /**
     * set：周结束时间
     */
    public WorkPlan setWeekEnd(Date weekEnd) {
        this.weekEnd = weekEnd;
        return this;
    }

    /**
     * get：周结束时间
     */
    public Date getWeekEnd() {
        return weekEnd;
    }

    /**
     * set：实际总工时:人天
     */
    public WorkPlan setActualEffort(BigDecimal actualEffort) {
        this.actualEffort = actualEffort;
        return this;
    }

    /**
     * get：实际总工时:人天
     */
    public BigDecimal getActualEffort() {
        return actualEffort;
    }

    /**
     * set：提交状态
     */
    public WorkPlan setSubmissionStatus(PlanSubmissionStatusEnum submissionStatus) {
        this.submissionStatus = submissionStatus;
        return this;
    }

    /**
     * get：提交状态
     */
    public PlanSubmissionStatusEnum getSubmissionStatus() {
        return submissionStatus;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }


    /***************** set|get  end **************************************/
}
